﻿@using System
@using LunchListCore.Interfaces.Models
@model LunchList.ViewModels.EventsViewModel

<div class="col-lg-8 col-md-8 col-sm-8" >

    <h2>Upcoming Events</h2>
    <div class="panel panel-default" id="eventslist">
        <!-- Table -->
        <table class="table table table-striped">
            <thead>
                <tr>
                    <th>Event Name</th>
                    <th>Event Date</th>
                    <th>Event Time</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @foreach (IEvent evnt in Model.EventListFuture)
                {
                    string eventdateValue = DateTime.Parse(evnt.EventDate.ToString()).ToShortDateString();
                    string eventtimeValue = DateTime.Parse(evnt.EventDate.ToString()).ToShortTimeString();

                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => evnt.EventName)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => eventdateValue)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => eventtimeValue)
                        </td>
                        <td>
                            @Html.ActionLink("Delete", "DeleteEvent", new { id = evnt.EventId })
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>

<div class="col-lg-8 col-md-8 col-sm-8">
    <h2>Past Events</h2>
    @Html.ValidationSummary(false)
    <div class="panel panel-default" id="eventslist">
        <!-- Table -->
        <table class="table table table-striped">
            <thead>
                <tr>
                    <th>Event Name</th>
                    <th>Event Date</th>
                    <th>Event Time</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var evnt in Model.EventListPast)
                {
                    string eventdateValue = DateTime.Parse(evnt.EventDate.ToString()).ToShortDateString();
                    string eventtimeValue = DateTime.Parse(evnt.EventDate.ToString()).ToShortTimeString();

                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => evnt.EventName)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => eventdateValue)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => eventtimeValue)
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>

